-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcery Starbot ⭐ refactored enthyp/chat #15
base: master
Are you sure you want to change the base?
Conversation
else: | ||
log.err('DB: password_correct CALL FAILURE: no such user in database') | ||
raise failure.Failure(sqlite3.IntegrityError()) | ||
log.err('DB: password_correct CALL FAILURE: no such user in database') | ||
raise failure.Failure(sqlite3.IntegrityError()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DBService.password_correct
refactored with the following changes:
- Remove unnecessary else after guard condition (
remove-unnecessary-else
)
results = yield self._dbpool.runQuery(query.select_notifications, (user,)) | ||
return results | ||
return (yield self._dbpool.runQuery(query.select_notifications, (user,))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DBService.get_notifications
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
nicks = [] | ||
for k, v in self.user2peer.items(): | ||
if v == peer: | ||
nicks.append(k) | ||
nicks = [k for k, v in self.user2peer.items() if v == peer] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Dispatcher.remove_peer
refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension
)
@@ -490,7 +490,6 @@ def msg_JOIN(self, message): | |||
else: | |||
if self.connected: | |||
self.endpoint.no_channel(channel_name) | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function LoggedInState.msg_JOIN
refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass
)
if message.strip(" ") != "": | ||
if self.client: | ||
self.client.handle_input(message.strip(" ")) | ||
if message.strip(" ") != "" and self.client: | ||
self.client.handle_input(message.strip(" ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function GUI.send_message
refactored with the following changes:
- Merge nested if conditions (
merge-nested-ifs
)
conn = sqlite3.connect(app.config['DATABASE']) | ||
return conn | ||
return sqlite3.connect(app.config['DATABASE']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function connect_db
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
return list(set([row[1] for row in rows])) | ||
return list({row[1] for row in rows}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function extract_channels
refactored with the following changes:
- Replace unneeded comprehension with generator (
comprehension-to-generator
) - Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension
)
for i in range(0, len(ratings_list)): | ||
for j in range(0, 6): | ||
for i in range(len(ratings_list)): | ||
for j in range(6): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function history
refactored with the following changes:
- Replace range(0, x) with range(x) (
remove-zero-from-range
)
for i in range(0, len(ratings_list)): | ||
for j in range(0, 6): | ||
for i in range(len(ratings_list)): | ||
for j in range(6): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function channel
refactored with the following changes:
- Replace range(0, x) with range(x) (
remove-zero-from-range
)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: